home *** CD-ROM | disk | FTP | other *** search
- Unit ISAPISock;
-
- // Socket helper for ISAPI DLL's.
- // (C) 1996 Matt Taylor.
- // The source code ISAPISOCK.PAS is released to
- // the public domain.
-
- // THIS Socket Lib uses server calls that are specific to ServerSeven.
- // It will not work with other WWW servers!!!
-
- interface
-
- uses
- Windows, SysUtils, Classes, HTTPExt, Parser;
-
- const
- UNKNOWN_VARIABLE='UNKNOWN OR NOT SPECIFIED';
-
- type
- THTMLColor = $80000000..$7FFFFFFF;
-
- const
- hcBlack = THTMLColor($000000);
- hcGray = THTMLColor($808080);
- hcLtGray = THTMLColor($C0C0C0);
- hcRed = THTMLColor($FF0000);
- hcGreen = THTMLColor($00FF00);
- hcBlue = THTMLColor($0000FF);
- hcWhite = THTMLColor($FFFFFF);
-
- type
- EISAPISockError= class(Exception);
- EISAPISockTimeOut= class(Exception);
- EISAPIUnknown= class(Exception);
-
- const
- //MAXLINELENGTH=256;
- ESCAPESTRING='~!@#$%^&*()_+|\=-}{]["'':;?/>.<,`';
-
- type
- TISAPISock=class
- public
- // ISAPI Exit status and codes
- //ISAPIExitStatus: String;
- //ISAPIExitCode: Integer;
-
- constructor Create(var ecb: TEXTENSION_CONTROL_BLOCK);
- destructor Destroy; override;
-
- // Socket block access functions
- procedure Send(buf: PChar; len: DWORD);
- function Recv(buf: PChar; len: DWORD): DWORD;
-
- // Escape encode/decode
- function EscapeEncode(s: String): String;
- function EscapeDecode(s: String): String;
-
- // Query
- function GetQueryVal(keyName: String): String;
-
- // Form Vars
- function GetFormVal(keyName: String): String;
-
- // Cookie
- function GetCookieVal(keyName: String): String;
- procedure SetCookie(keyName, keyVal: String; daysToExpire: Integer);
- procedure ClearCookie(keyName: String);
-
- // Socket text/line access functions
- procedure Write(s: String);
- procedure Writeln(s: String);
- //function Readln: String;
- //function Peekln: String;
-
- // Socket control
- procedure SetTimeOut(tMS: DWORD);
- function GetTimeOut: DWORD;
-
- // ISAPI Server Variables
- function GetServerVariable(varName: String): String;
- function GetServerVariableEX(varName: String): String;
-
- // HTML Stuff
- procedure HHeader(title: String; backColor, textColor, linkColor: THTMLColor);
- procedure HPageStart;
- procedure HPageEnd;
- procedure HFormStart(method, executable: String);
- procedure HFormEnd(submitButtonName, resetButtonName: String);
-
- // Line types
- procedure HImage(s: String);
- procedure HHeading(size: Integer; s: String);
- procedure HLine(s: String);
- procedure HBullet(s: String);
- procedure HSeparator;
-
- // Formatting
- function HBold(s: String): String;
- function HItalic(s: String): String;
- function HRef(ref, text: String): String;
- function HFontSize(s: String; size: Integer): String;
- function HCenter(s: String): String;
-
- // Form Controls
- procedure HEditBox(caption, fName, defaultText: String; size, maxlength: Integer);
- procedure HRadioBtn(caption: String; const text: array of String; fName: String; const fValue: array of String; default: String );
- procedure HCheckBox(caption: String; const text: array of String; fName: String; const fValue: array of String; default: array of String);
- procedure HListBox(caption: String; const text: array of String; fName: String);
-
- private
- ExtContBlock: TEXTENSION_CONTROL_BLOCK;
- TimeOut: DWORD;
- Term: String;
- ConnID: HCONN;
- FNRead: TReadClientProc;
- FNWrite: TWriteClientProc;
- FNServerSupport: TServerSupportFunctionProc;
- FNGetServerVariable: TGetServerVariableProc;
- end;
-
-
-
-
- implementation
-
-
-
- end.
-